import { ENUM_UI } from "../GbzEnum";
import GbzInstance from "../GbzInstance";
import GbzDataManager from "../manager/GbzDataManager";
import BaseLayer from "./GbzBaselayer";

const { ccclass, property } = cc._decorator;

@ccclass
export default class GbzLoadingLayer extends BaseLayer {
    @property(cc.Sprite)
    fill: cc.Sprite = null

    update(dt: number) {
        if (this.fill && this.node.active) {
            this.fill.fillRange = GbzDataManager.ins.loading_rate
            if (GbzDataManager.ins.loading_rate >= 1) {
                if (GbzInstance.uiMgr.hasActive(ENUM_UI.LAYER_MENU)) {
                    this.hide()
                }
            }
        }
    }
}
